The string after the double equals == in the if statement is the test value. It is the value we're testing for.
Change the test value to "a".
Change the string in the .set_text() command to "Great job!"
Now, we're testing if the variable choice is equal to the string "a".If it is, we tell the user "Great job!"
To navigate the page using the TAB key, first press ESC to exit the code editor.
stage.set_background("schoolentrance")
sprite = codesters.Sprite("person10")
sprite.go_to(-125, -100)
emma = codesters.Sprite("person8")
emma.move_down(125)
emma.say("Someone took my phone!")
stage.wait(2)
emma.say("They've been sending people mean texts pretending to be me!")
stage.wait(2)
sprite.say("What should I do?")
stage.wait(2)
choice = sprite.ask("a) tell a trusted adult b) tell people Emma is sending the messages c) ignore Emma")
# text = codesters.Text("text", x, y)
text = codesters.Text("Hello up here.", 0, 200)
if choice == "yes":
# add your code here
sprite.say("I am a sprite.")
t = codesters.Teacher()
try:
tval1 = t.find_block('if')[0][1].replace(' ' ,'')
tval2 = t.get_indent_at_line(t.find_block('if')[0][0])
except:
tval1 = "DNE"
tval2 = "DNE"
try:
param = t.find_function('set_text')
tval3 = t.find_function('set_text')[0][1].replace(' ', '').lower()
tval4 = t.get_indent_at_line(t.find_text('set_text')[0][0])
except:
tval3 = "DNE"
tval4 = "DNE"
#print tval1, tval2, tval3, tval4
#print param
t1 = TestObjective()
t1.add_success('ifchoice=="a":' in tval1, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add an if statement?")
t1.add_failure('"a"' not in tval1, 'Did you change the test value to "a"?')
t1.add_failure('"yes"' in tval1, 'Make sure you change the test value in the if statement to "a".')
t2 = TestObjective()
t2.add_success('greatjob' in tval3 and tval4 == 4, "Great job!")
t2.add_failure(tval3 == "DNE", "Did you delete the Set Text command?")
t2.add_failure('greatjob' not in tval3, "Did you change the string in the set text command?")
t2.add_failure(tval4 == 0, "Make sure your Set Text command is indented 4 spaces inside your if statement.")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time.
Try stopping other Codesters projects or closing
other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit,
reloading this page, and reconnecting your Micro:bit.